//
//  YSShareManager.h
//  newYueLvHui
//
//  Created by Apple on 2020/9/12.
//  Copyright © 2020 Facebook. All rights reserved.
//
/*
 分享示例
 
    /// 自定义分享面板标题
    NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:@"分享好友下单"];
    
    /// 创建网页分享Model
    YSShareWebLinkModel *webModel = [YSShareWebLinkModel new];
    ......
 
    /// 初始化分享管理类
    YSShareManager *manager = [YSShareManager new];
    [manager sharePlatforms:@[@(YS_WXSession),@(YS_CopyLink),@(YS_Placard)] layoutColumn:3 layoutRow:1 shareMessageModel:webModel shareViewTitle:att];
    
    /// 点击生成海报事件回调，需要调用生成海报接口，然后弹出分享UI
    manager.createPlacardActionBlock = ^(YSShareManager *manager) {
        /// 先请求生成海报的接口，待返回海报Url后再调用
        YSShareImageModel *imgModel = YSShareImageModel.new;
        imgModel.placard_url = placard_url;
        [manager createPlacardWithData:imgModel];
    };
    
    /// 如果需要分享小程序
    manager.shareMinProgramActionBlock = ^(YSShareManager *manager) {
        YSShareMinProgramModel *model = [YSShareMinProgramModel new];
        model.userName = @"小程序原始id";
        model.path = @"小程序页面路径";
        [manager shareMinProgramToWXWithData:model];
    };
 */

#import <Foundation/Foundation.h>
#import "YSShareModel.h"

NS_ASSUME_NONNULL_BEGIN

@interface YSShareManager : NSObject

/// 自定义item样式（选填） 可单独配置某一个 若分享类型包含YS_Other 则为必填项
@property (nonatomic, strong) NSArray <YSShareModel *> *customConfig;

/// 分享、弹出底部分享菜单
/// @param platforms 分享平台数组：@[@(YS_WXSession),@(YS_WXTimeline)]
/// @param shareData 分享数据模型2种 ，分享图片：YSShareImageModel，
///                                分享网页：YSShareWebLinkModel，
/// @param column 布局列数，最多4列
/// @param row  布局行数，最多2行
/// @param attrString  弹出view的标题 默认@"分享"
- (void)sharePlatforms:(NSArray *)platforms
          layoutColumn:(NSInteger)column
             layoutRow:(NSInteger)row
     shareMessageModel:(YSShareMessageModel *)shareData
        shareViewTitle:(NSAttributedString * __nullable)attrString;

/// 分享、弹出底部分享菜单
/// @param platforms 分享平台数组：@[@(YS_WXSession),@(YS_WXTimeline)]
/// @param shareData 分享数据模型2种 ，分享图片：YSShareImageModel，
///                          分享网页链接：YSShareWebLinkModel，
/// @param column 布局列数，最多4列
/// @param row  布局行数，最多2行
- (void)sharePlatforms:(NSArray *)platforms
          layoutColumn:(NSInteger)column
             layoutRow:(NSInteger)row
     shareMessageModel:(YSShareMessageModel *)shareData;

/// 生成海报, 配合createPlacardActionBlock回调使用
/// @param shareModel 数据
- (void)createPlacardWithData:(YSShareImageModel *)shareModel;

/// 分享小程序
- (void)shareMinProgramToWXWithData:(YSShareMinProgramModel *)shareModel;


/// 点击复制链接事件回调，自定义的话需要实现
@property (nonatomic,copy) void (^copyLinkActionBlock)(YSShareManager *manager);

/// 点击生成海报事件回调,自定义的话需要实现
@property (nonatomic,copy) void (^createPlacardActionBlock)(YSShareManager *manager);

/// 点击分享小程序事件回调,需要自定义分享具体哪个小程序的参数
@property (nonatomic,copy) void (^shareMinProgramActionBlock)(YSShareManager *manager);

/// 保存相册完成回调 默认弹窗保存成功
@property (nonatomic,copy) void (^saveCompletionActionBlock)(YSShareManager *manager);

/// 点击自定义按钮事件回调
@property (nonatomic,copy) void (^customActionBlock)(YSShareManager *manager);

@end

NS_ASSUME_NONNULL_END
